//
//  WiiNewsViewController.m
//  SoccerHoneypot
//
//  Created by Wii on 16/7/5.
//  Copyright © 2016年 Wii. All rights reserved.
//

#import "WiiNewsViewController.h"

#import "WiiNewsItemPageView.h"

@interface WiiNewsViewController ()

@end

@implementation WiiNewsViewController

- (instancetype)initWithCoder:(NSCoder *)aDecoder {
    self = [super initWithCoder:aDecoder];
    if (self) {
        self.menuItemWidth = SCREEN_WIDTH / 5;
        self.menuViewStyle = WMMenuViewStyleLine;
        self.titleSizeSelected = 15.0;
        self.titleColorSelected = mx_Wode_colorBlue2374e4 ;
    }
    return self;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    self.navigationController.navigationBar.barTintColor = mx_Wode_colorBlue2374e4;
    

    self.navigationController.navigationBar.translucent = NO;
    
    
    [self.navigationController.navigationBar setTitleTextAttributes:@{NSForegroundColorAttributeName : [UIColor whiteColor]}];
    self.navigationItem.backBarButtonItem=[[UIBarButtonItem alloc] initWithTitle:@"" style:UIBarButtonItemStylePlain target:self action:nil];
    self.navigationController.navigationBar.tintColor=[UIColor whiteColor];
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

#pragma mark - WMPageController DataSource
- (NSInteger)numbersOfChildControllersInPageController:(WMPageController *)pageController {
    return self.titles.count;
}

- (NSString *)pageController:(WMPageController *)pageController titleAtIndex:(NSInteger)index {
    return self.titles[index];
}

- (CGRect)pageController:(WMPageController *)pageController preferredFrameForMenuView:(WMMenuView *)menuView {
    
    return CGRectMake(0, 0, self.view.frame.size.width, 44);
}
- (CGRect)pageController:(WMPageController *)pageController preferredFrameForContentView:(WMScrollView *)contentView {
    
    CGFloat originY = CGRectGetMaxY([self pageController:pageController preferredFrameForMenuView:self.menuView]);

    return CGRectMake(0, originY, self.view.frame.size.width, self.view.frame.size.height - originY);
}
- (UIViewController *)pageController:(WMPageController *)pageController viewControllerAtIndex:(NSInteger)index {
    
    NSArray *urlArray = @[API_TopNews,API_LIGABBVA,API_PremierLeague,API_Bundesliga,API_SerieA,API_CSL,API_Transfer];
    
    UIStoryboard *sb = [UIStoryboard storyboardWithName:@"News" bundle:nil];
    WiiNewsItemPageView *vc = [sb instantiateViewControllerWithIdentifier:@"PageView"];
    vc.urlString = urlArray[index];
    return vc;
}

#pragma mark - LazzyLoad

- (NSArray<NSString *> *)titles {
    return @[@"头条",@"西甲",@"英超",@"德甲",@"意甲",@"中超",@"转会市场"];
}


@end
